package com.yoomiito.app.adapter.my;

import androidx.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yoomiito.app.R;
import com.yoomiito.app.model.my.MyHistoryMonthBean;
import com.yoomiito.app.utils.AllUtils;
import com.yoomiito.app.utils.ResUtil;
import com.yoomiito.app.utils.SpannableUtils;

import java.util.List;

public class MyHistoryMonthAdapter extends BaseQuickAdapter<MyHistoryMonthBean, BaseViewHolder> {
    public MyHistoryMonthAdapter(@Nullable List<MyHistoryMonthBean> data) {
        super(R.layout.item_my_history_income, data);
    }

    @Override
    protected void convert(final BaseViewHolder helper, MyHistoryMonthBean item) {
        helper.setVisible(R.id.otherDesTv,true);
        if (item.isTitle()){
            ((TextView)helper.getView(R.id.tv_date)).setText(item.getMonth() + "月");
            ((TextView)helper.getView(R.id.tv_taobao)).setText("导购引流");
            ((TextView)helper.getView(R.id.tv_gift_explosive)).setText("自营商品");
            ((TextView)helper.getView(R.id.otherDesTv)).setText("其他");

            ((TextView)helper.getView(R.id.tv_date)).setTextColor(ResUtil.getColor(R.color.color_balk_999999));
            ((TextView)helper.getView(R.id.tv_taobao)).setTextColor(ResUtil.getColor(R.color.color_balk_999999));
            ((TextView)helper.getView(R.id.tv_gift_explosive)).setTextColor(ResUtil.getColor(R.color.color_balk_999999));
            ((TextView)helper.getView(R.id.otherDesTv)).setTextColor(ResUtil.getColor(R.color.color_balk_999999));

        }else{
            ((TextView)helper.getView(R.id.tv_date)).setText(item.getDay() + "日");
            ((TextView)helper.getView(R.id.tv_taobao)).setText(item.getTt1());
            ((TextView)helper.getView(R.id.tv_gift_explosive)).setText(item.getTt2());
            ((TextView)helper.getView(R.id.otherDesTv)).setText(SpannableUtils.saleNum2(item.getOthers()));

            ((TextView)helper.getView(R.id.tv_date)).setTextColor(ResUtil.getColor(R.color.color_balk_333333));
            ((TextView)helper.getView(R.id.tv_taobao)).setTextColor(ResUtil.getColor(R.color.color_balk_333333));
            ((TextView)helper.getView(R.id.tv_gift_explosive)).setTextColor(ResUtil.getColor(R.color.color_balk_333333));
            ((TextView)helper.getView(R.id.otherDesTv)).setTextColor(ResUtil.getColor(R.color.color_balk_333333));

        }
    }
}
